var ASSERT = require('assert');
var parseLog = require('../src/parseLog');
var CaseResult = require('../src/caseResult');
var Report = require('../');

var task = {
	name: '',
	createtime: 1459501509816,
	schemas: {
		"object": null,
		"caseList": [{
			"caseId": 64,
			"name": "用户名重名测试",
			"code": "#TIMES 1\n#INTERVAL 3000\n//用户名重名测试\nprocess main {\n\tjumpto '/#/register';\n\twait 2000;\n\tinput \"form.grid > div:nth-child(1) > input.form-control\" by |[a-z0-9]{8}|;\n\tclick \"form.grid > div:nth-child(2) > input.form-control\";\n\t//断言是存在用户名重复提示内容\n\tassert <@\"form.grid > div:nth-child(1) > div:nth-child(4)\"/> ==\"用户名重复\" in 1000;\n}"
		}, {
			"caseId": 65,
			"name": "邮箱重复",
			"code": "#TIMES 1\n#INTERVAL 3000\n//判断邮箱是否重复\nprocess main {\n\tjumpto '/#/register';\n\twait 2000;\n\tinput \"form.grid > div:nth-child(2) > input.form-control\" by \"liyueyu@or-change.cn\";\n\tclick \"form.grid > div:nth-child(3) > input.form-control\";\n\tassert <@ \"form.grid > div:nth-child(2) > div:nth-child(4)\"/>==\"邮箱重复\";\n}"
		}, {
			"caseId": 67,
			"name": "登录我的账号",
			"code": "#TIMES 1\n#INTERVAL 3000\n\n//登录我的账号\nprocess main {\n\tjumpto '/#/login';\n\tassert 2000;\n\tinput \"form > div:nth-child(1) > input.form-control\" by \"y_tombi\";\n\tinput \"form > div:nth-child(2) > input.form-control\" by \"11111111\";\n\tinput \"form > div:nth-child(3) > input.form-control\" by \"1111\";\n\tclick 'form > button.btn'; \n}"
		}, {
			"caseId": 68,
			"name": "创建项目按钮点击后跳转成功",
			"code": "#TIMES 1\n#INTERVAL 3000\n\n//必须在登陆后才能执行这个用例\n\n//创建项目按钮点击后跳转成功\nprocess main {\n\tjumpto '/#/project';\n\twait 2000;\n\tclick \"div.col-lg-8 > a.btn\";\n\t//断言跳转页面是否成功，时间1000毫秒。\n\tassert <@ \"h2\" /> ==\"创建待测项目\" in 1000;\n}"
		}, {
			"caseId": 70,
			"name": "创建项目",
			"code": "#TIMES 1\n#INTERVAL 3000\n\n//必须在登陆后才能执行这个用例\n\n//创建项目\nprocess main {\n\tjumpto '/#/project/add';\n\twait 2000;\n\tvar projectName = |[a-z0-9]{8}|;\n\tinput \"div.form-group > input.form-control\" by projectName;\n\tinput \"textarea.form-control\" by |[a-z0-9]{20}|;\n\twait 1000;\n\tclick \"div.col-lg-8 > button.btn\";\n\tassert <@ \"h2\"/> ~~ projectName in 1500;\n}"
		}, {
			"caseId": 71,
			"name": "打开第三个测试项目是否成功",
			"code": "#TIMES 1\n#INTERVAL 3000\n\n//打开第三个测试项目是否成功\nprocess main {\n\tjumpto '/#/project';\n\twait 2000;\n\t//保存即将打开的测试项目的名字\n\tvar projectName = <@ \"ul.porject-list > li:nth-child(4) > a\"/>;\n\tclick 'ul.porject-list > li:nth-child(4) > a';\n\tassert <@ \"h2\"/> ~~ projectName in 1500;\n}"
		}, {
			"caseId": 72,
			"name": "删除某个测试项目",
			"code": "#TIMES 1\n#INTERVAL 3000\n\n//删除某个测试项目\nprocess main {\n\tjumpto '/#/project';\n\twait 2000;\n\tclick \"ul.porject-list > li:nth-child(6) > a\";\n\twait 1000;\n\tclick \"div.col-md-8 > button:nth-child(3)\";\n\tinput 'form > input.form-control' by \"DELETE\";\n\twait 500;\n\tclick \"div.input-group > span:nth-child(3) > button.btn\";\n\tassert <@\"h2\"/> ~~\"项目列表\" in 1500;\n}"
		}],
		"config": {}
	}
};
var data = {
	name: 'forDebug',
	"tR": [
		{
			name: 'fdsfs',
			data: {
				"ua": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0",
				"platform": "Win32",
				"taskResult": [{
					"log": {
						"baseTime": 1459501485050,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3012, 0], [[20, "/#/register"], 3022, 5], [[17, 2000], 3031, 6], [[18, 1, "form.grid > div:nth-child(1) > input.form-control", "input", {
							"value": "1osbgua3"
					}], 5044, 7], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "click", {}], 5055, 8], [[19, 1], 5056, 10], [[1], 5066, 0], [[2, 1], 5075, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501490126,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3011, 0], [[20, "/#/register"], 3021, 5], [[17, 2000], 3030, 6], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "input", {
							"value": "liyueyu@or-change.cn"
					}], 5049, 7], [[18, 1, "form.grid > div:nth-child(3) > input.form-control", "click", {}], 5062, 8], [[19, 1], 5068, 9], [[1], 5072, 0], [[2, 1], 5082, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501495209,
						"marks": [[0, 0, 4]],
						"logs": [[[0, "main"], 3010, 0], [[20, "/#/login"], 3072, 6], [[19, 1], 3185, 7], [[18, 0, "form > div:nth-child(1) > input.form-control", "input", {
							"value": "y_tombi"
					}], 3194, 8], [[2, 0], 3195, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501498404,
						"marks": [[1, 0, 6]],
						"logs": [[[0, "main"], 3015, 0], [[20, "/#/project"], 3025, 8], [[17, 2000], 3035, 9], [[18, 1, "div.col-lg-8 > a.btn", "click", {}], 5082, 10], [[19, 1], 5099, 12], [[1], 5104, 0], [[2, 1], 5109, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501503513,
						"marks": [[1, 0, 9]],
						"logs": [[[0, "main"], 3016, 0], [[20, "/#/project/add"], 3025, 8], [[17, 2000], 3034, 9], [[18, 1, "div.form-group > input.form-control", "input", {
							"value": "vmu39v56"
					}], 5063, 11], [[18, 1, "textarea.form-control", "input", {
							"value": "7zigbhd4hhx0bn0f241c"
					}], 5074, 12], [[17, 1000], 5080, 13], [[18, 1, "div.col-lg-8 > button.btn", "click", {}], 6090, 14], [[19, 1], 6285, 15], [[1], 6299, 0], [[2, 1], 6303, 0]],
						"performance": {
							"#0": [187]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501509816,
						"marks": [[0, 0, 4]],
						"logs": [[[0, "main"], 3012, 0], [[20, "/#/project"], 3034, 6], [[17, 2000], 3048, 7], [[18, 1, "ul.porject-list > li:nth-child(4) > a", "click", {}], 5094, 10], [[2, 0], 6620, 0]],
						"performance": {
							"#0": []
						}
					}
				}, {
					"log": {
						"baseTime": 1459501516437,
						"marks": [[1, 0, 11]],
						"logs": [[[0, "main"], 3010, 0], [[20, "/#/project"], 3033, 6], [[17, 2000], 3048, 7], [[18, 1, "ul.porject-list > li:nth-child(6) > a", "click", {}], 5083, 8], [[17, 1000], 5106, 9], [[18, 1, "div.col-md-8 > button:nth-child(3)", "click", {}], 6111, 10], [[18, 1, "form > input.form-control", "input", {
							"value": "DELETE"
					}], 6119, 11], [[17, 500], 6128, 12], [[18, 1, "div.input-group > span:nth-child(3) > button.btn", "click", {}], 6641, 13], [[19, 1], 6697, 14], [[1], 6714, 0], [[2, 1], 6719, 0]],
						"performance": {
							"#0": [50]
						}
					}
				}]
			}
		},
		{
			name: 'fdsfsdfa',
			data: {
				"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586",
				"platform": "Win32",
				"taskResult": [{
					"log": {
						"baseTime": 1459501758787,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3032, 0], [[20, "/#/register"], 3041, 5], [[17, 2000], 3292, 6], [[18, 1, "form.grid > div:nth-child(1) > input.form-control", "input", {
							"value": "ze6ks3rq"
						}], 5320, 7], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "click", {}], 5454, 8], [[19, 1], 5455, 10], [[1], 5476, 0], [[2, 1], 5494, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501764281,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3030, 0], [[20, "/#/register"], 3038, 5], [[17, 2000], 3050, 6], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "input", {
							"value": "liyueyu@or-change.cn"
						}], 5060, 7], [[18, 1, "form.grid > div:nth-child(3) > input.form-control", "click", {}], 5075, 8], [[19, 1], 5076, 9], [[1], 5086, 0], [[2, 1], 5103, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501769384,
						"marks": [[1, 0, 8]],
						"logs": [[[0, "main"], 3016, 0], [[20, "/#/login"], 3025, 6], [[19, 1], 3048, 7], [[18, 1, "form > div:nth-child(1) > input.form-control", "input", {
							"value": "y_tombi"
						}], 3061, 8], [[18, 1, "form > div:nth-child(2) > input.form-control", "input", {
							"value": "11111111"
						}], 3076, 9], [[18, 1, "form > div:nth-child(3) > input.form-control", "input", {
							"value": "1111"
						}], 3100, 10], [[18, 1, "form > button.btn", "click", {}], 3137, 11], [[1], 3140, 0], [[2, 1], 3152, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501772536,
						"marks": [[1, 0, 6]],
						"logs": [[[0, "main"], 3024, 0], [[20, "/#/project"], 3037, 8], [[17, 2000], 3044, 9], [[18, 1, "div.col-lg-8 > a.btn", "click", {}], 5066, 10], [[19, 1], 5066, 12], [[1], 5085, 0], [[2, 1], 5085, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501777621,
						"marks": [[1, 0, 9]],
						"logs": [[[0, "main"], 3014, 0], [[20, "/#/project/add"], 3026, 8], [[17, 2000], 3034, 9], [[18, 1, "div.form-group > input.form-control", "input", {
							"value": "lgky6ox8"
						}], 5050, 11], [[18, 1, "textarea.form-control", "input", {
							"value": "vwdg4d3q5jc0a15nslby"
						}], 5062, 12], [[17, 1000], 5070, 13], [[18, 1, "div.col-lg-8 > button.btn", "click", {}], 6074, 14], [[19, 1], 6189, 15], [[1], 6199, 0], [[2, 1], 6203, 0]],
						"performance": {
							"#0": [110]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501783824,
						"marks": [[0, 0, 4]],
						"logs": [[[0, "main"], 3023, 0], [[20, "/#/project"], 3032, 6], [[17, 2000], 3052, 7], [[18, 1, "ul.porject-list > li:nth-child(4) > a", "click", {}], 5105, 10], [[2, 0], 6610, 0]],
						"performance": {
							"#0": []
						}
					}
				}, {
					"log": {
						"baseTime": 1459501790434,
						"marks": [[1, 0, 11]],
						"logs": [[[0, "main"], 3013, 0], [[20, "/#/project"], 3023, 6], [[17, 2000], 3041, 7], [[18, 1, "ul.porject-list > li:nth-child(6) > a", "click", {}], 5078, 8], [[17, 1000], 5079, 9], [[18, 1, "div.col-md-8 > button:nth-child(3)", "click", {}], 6088, 10], [[18, 1, "form > input.form-control", "input", {
							"value": "DELETE"
						}], 6106, 11], [[17, 500], 6115, 12], [[18, 1, "div.input-group > span:nth-child(3) > button.btn", "click", {}], 6619, 13], [[19, 1], 6691, 14], [[1], 6699, 0], [[2, 1], 6732, 0]],
						"performance": {
							"#0": [58]
						}
					}
				}]
			}
		},
		{
			name: 'fsdfsdf',
			data: {
				"ua": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko",
				"platform": "Win32",
				"taskResult": [{
					"log": {
						"baseTime": 1459501820236,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3031, 0], [[20, "/#/register"], 3044, 5], [[17, 2000], 3047, 6], [[18, 1, "form.grid > div:nth-child(1) > input.form-control", "input", {
							"value": "2j5cvpgv"
						}], 5118, 7], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "click", {}], 5159, 8], [[19, 1], 5165, 10], [[1], 5179, 0], [[2, 1], 5195, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501825432,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3030, 0], [[20, "/#/register"], 3042, 5], [[17, 2000], 3050, 6], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "input", {
							"value": "liyueyu@or-change.cn"
						}], 5057, 7], [[18, 1, "form.grid > div:nth-child(3) > input.form-control", "click", {}], 5071, 8], [[19, 1], 5130, 9], [[1], 5135, 0], [[2, 1], 5153, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501830585,
						"marks": [[1, 0, 8]],
						"logs": [[[0, "main"], 3016, 0], [[20, "/#/login"], 3026, 6], [[19, 1], 3051, 7], [[18, 1, "form > div:nth-child(1) > input.form-control", "input", {
							"value": "y_tombi"
						}], 3063, 8], [[18, 1, "form > div:nth-child(2) > input.form-control", "input", {
							"value": "11111111"
						}], 3078, 9], [[18, 1, "form > div:nth-child(3) > input.form-control", "input", {
							"value": "1111"
						}], 3094, 10], [[18, 1, "form > button.btn", "click", {}], 3173, 11], [[1], 3174, 0], [[2, 1], 3184, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501833770,
						"marks": [[1, 0, 6]],
						"logs": [[[0, "main"], 3027, 0], [[20, "/#/project"], 3035, 8], [[17, 2000], 3047, 9], [[18, 1, "div.col-lg-8 > a.btn", "click", {}], 5074, 10], [[19, 1], 5075, 12], [[1], 5085, 0], [[2, 1], 5096, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501838866,
						"marks": [[1, 0, 9]],
						"logs": [[[0, "main"], 3014, 0], [[20, "/#/project/add"], 3027, 8], [[17, 2000], 3034, 9], [[18, 1, "div.form-group > input.form-control", "input", {
							"value": "l2i446zo"
						}], 5056, 11], [[18, 1, "textarea.form-control", "input", {
							"value": "53xjjf8kmg73qlab6vw6"
						}], 5114, 12], [[17, 1000], 5116, 13], [[18, 1, "div.col-lg-8 > button.btn", "click", {}], 6130, 14], [[19, 1], 6240, 15], [[1], 6245, 0], [[2, 1], 6251, 0]],
						"performance": {
							"#0": [96]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501845117,
						"marks": [[0, 0, 4]],
						"logs": [[[0, "main"], 3013, 0], [[20, "/#/project"], 3022, 6], [[17, 2000], 3037, 7], [[18, 1, "ul.porject-list > li:nth-child(4) > a", "click", {}], 5083, 10], [[2, 0], 6596, 0]],
						"performance": {
							"#0": []
						}
					}
				}, {
					"log": {
						"baseTime": 1459501851713,
						"marks": [[1, 0, 11]],
						"logs": [[[0, "main"], 3016, 0], [[20, "/#/project"], 3026, 6], [[17, 2000], 3041, 7], [[18, 1, "ul.porject-list > li:nth-child(6) > a", "click", {}], 5077, 8], [[17, 1000], 5082, 9], [[18, 1, "div.col-md-8 > button:nth-child(3)", "click", {}], 6092, 10], [[18, 1, "form > input.form-control", "input", {
							"value": "DELETE"
						}], 6111, 11], [[17, 500], 6120, 12], [[18, 1, "div.input-group > span:nth-child(3) > button.btn", "click", {}], 6625, 13], [[19, 1], 6736, 14], [[1], 6737, 0], [[2, 1], 6770, 0]],
						"performance": {
							"#0": [98]
						}
					}
				}]
			}
		},
		{
			name: 'dfsfs',
			data: {
				"ua": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36",
				"platform": "Win32",
				"taskResult": [{
					"log": {
						"baseTime": 1459501885056,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3024, 0], [[20, "/#/register"], 3034, 5], [[17, 2000], 3043, 6], [[18, 1, "form.grid > div:nth-child(1) > input.form-control", "input", {
							"value": "yi7ylk4j"
						}], 5055, 7], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "click", {}], 5060, 8], [[19, 1], 5064, 10], [[1], 5073, 0], [[2, 1], 5084, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501890140,
						"marks": [[1, 0, 7]],
						"logs": [[[0, "main"], 3022, 0], [[20, "/#/register"], 3033, 5], [[17, 2000], 3042, 6], [[18, 1, "form.grid > div:nth-child(2) > input.form-control", "input", {
							"value": "liyueyu@or-change.cn"
						}], 5046, 7], [[18, 1, "form.grid > div:nth-child(3) > input.form-control", "click", {}], 5057, 8], [[19, 1], 5062, 9], [[1], 5072, 0], [[2, 1], 5082, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501895222,
						"marks": [[1, 0, 8]],
						"logs": [[[0, "main"], 3024, 0], [[20, "/#/login"], 3049, 6], [[19, 1], 3068, 7], [[18, 1, "form > div:nth-child(1) > input.form-control", "input", {
							"value": "y_tombi"
						}], 3077, 8], [[18, 1, "form > div:nth-child(2) > input.form-control", "input", {
							"value": "11111111"
						}], 3087, 9], [[18, 1, "form > div:nth-child(3) > input.form-control", "input", {
							"value": "1111"
						}], 3097, 10], [[18, 1, "form > button.btn", "click", {}], 3108, 11], [[1], 3114, 0], [[2, 1], 3124, 0]],
						"performance": {}
					}
				}, {
					"log": {
						"baseTime": 1459501898346,
						"marks": [[1, 0, 6]],
						"logs": [[[0, "main"], 3017, 0], [[20, "/#/project"], 3028, 8], [[17, 2000], 3037, 9], [[18, 1, "div.col-lg-8 > a.btn", "click", {}], 5052, 10], [[19, 1], 5054, 12], [[1], 5058, 0], [[2, 1], 5069, 0]],
						"performance": {
							"#0": [0]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501903415,
						"marks": [[1, 0, 9]],
						"logs": [[[0, "main"], 3015, 0], [[20, "/#/project/add"], 3025, 8], [[17, 2000], 3034, 9], [[18, 1, "div.form-group > input.form-control", "input", {
							"value": "hbour7v2"
						}], 5047, 11], [[18, 1, "textarea.form-control", "input", {
							"value": "97ddkn0x4w70i5homyze"
						}], 5057, 12], [[17, 1000], 5064, 13], [[18, 1, "div.col-lg-8 > button.btn", "click", {}], 6066, 14], [[19, 1], 6209, 15], [[1], 6215, 0], [[2, 1], 6225, 0]],
						"performance": {
							"#0": [135]
						}
					}
				}, {
					"log": {
						"baseTime": 1459501909640,
						"marks": [[0, 0, 4]],
						"logs": [[[0, "main"], 3011, 0], [[20, "/#/project"], 3026, 6], [[17, 2000], 3030, 7], [[18, 1, "ul.porject-list > li:nth-child(4) > a", "click", {}], 5060, 10], [[2, 0], 6570, 0]],
						"performance": {
							"#0": []
						}
					}
				}, {
					"log": {
						"baseTime": 1459501916210,
						"marks": [[1, 0, 11]],
						"logs": [[[0, "main"], 3011, 0], [[20, "/#/project"], 3026, 6], [[17, 2000], 3030, 7], [[18, 1, "ul.porject-list > li:nth-child(6) > a", "click", {}], 5048, 8], [[17, 1000], 5050, 9], [[18, 1, "div.col-md-8 > button:nth-child(3)", "click", {}], 6057, 10], [[18, 1, "form > input.form-control", "input", {
							"value": "DELETE"
						}], 6063, 11], [[17, 500], 6071, 12], [[18, 1, "div.input-group > span:nth-child(3) > button.btn", "click", {}], 6582, 13], [[19, 1], 6629, 14], [[1], 6631, 0], [[2, 1], 6641, 0]],
						"performance": {
							"#0": [39]
						}
					}
				}]
			}
		}
	]
};

//ASSERT.ok(data);
//
//var c = new CaseResult(data.tR[0], null);
//ASSERT.ok(c);

var r = new Report(task, data);
ASSERT.ok(r);
console.log(JSON.stringify(r.$resultList[0].$env, null, 2));
console.log(r.$overview);
